home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / dev / obero / Interfaces3_4.lha / Interfaces / Sana2.mod < prev    next >
Text File  |  1994-03-05  |  10KB  |  257 lines

  1. (*(********************************************************************
  2.  
  3. :Program.    Sana2.mod
  4. :Contents.   Structure definitions for SANA-II devices
  5. :Author.     (Original) Raymond S. Brand, Dale Larson
  6. :Author.     (Oberon) bene@amokut.adsp.sub.org (Nicolas Benezan)
  7. :Copyright.  (C) Copyright 1991 Commodore-Amiga Inc.
  8. :Copyright.  All Rights Reserved
  9. :Language.   Oberon
  10. :Translator. Amiga Oberon Compiler V3.0
  11. :History.    V1.4 bene 25-Nov-91 ported from sana.h 91/11/07
  12. :History.    V1.5 bene 23-Apr-92 + LONGBOOL
  13. :History.    V1.6 bene 11-Jun-92 adapted to compiler 2.25
  14. :History.    V1.7 bene 24-Jul-92 compiler 2.39, BYTE -> SHORTINT
  15. :History.    V1.8 bene 10-Dec-92 DeviceStats bug fixed
  16. :History.    V1.9 bene 16-May-93 + amokNet
  17. :History.    V1.10 hG  20-May-93 updated to V39, rearranged
  18. :History.    40.15 hG  28-Dec-93 updated to V40.15, bumped version/rev.
  19. :Version.    $VER: Sana2.mod 40.15 (28.12.93) Oberon 3.0
  20.  
  21. ********************************************************************)*)
  22.  
  23. MODULE Sana2; (* $Implementation- *)
  24.  
  25. IMPORT
  26.   e * := Exec,
  27.   Timer *,
  28.   u * := Utility;
  29.  
  30. CONST
  31.   maxAddrBits  * = 128;
  32.   maxAddrBytes * = (maxAddrBits + 7) DIV 8;
  33.  
  34. TYPE
  35.   Sana2Address         * = ARRAY maxAddrBytes OF SHORTINT;
  36.   StatDataPtr          * = UNTRACED POINTER TO StatData;
  37.   IOSana2ReqPtr        * = UNTRACED POINTER TO IOSana2Req;
  38.   DeviceQueryPtr       * = UNTRACED POINTER TO DeviceQuery;
  39.   PacketTypeStatsPtr   * = UNTRACED POINTER TO PacketTypeStats;
  40.   SpecialStatHeaderPtr * = UNTRACED POINTER TO SpecialStatHeader;
  41.   DeviceStatsPtr       * = UNTRACED POINTER TO DeviceStats;
  42.   BufferMngDataPtr     * = UNTRACED POINTER TO BufferMngData;
  43.  
  44.   CopyBuffProc * = PROCEDURE (to{8}   : e.APTR;
  45.                               from{9} : e.APTR;
  46.                               count{0}: LONGINT): e.LONGBOOL;
  47.  
  48.   BufferMngData * = STRUCT END;
  49.   BufferTagList * = STRUCT (dummy *: BufferMngData)
  50.     tags *: u.Tags2;
  51.   END;
  52.  
  53.   IOSana2Req * = STRUCT (ioReq *: e.IORequest)
  54.     wireError  * : LONGINT;           (* wire type specific error     *)
  55.     packetType * : LONGINT;           (* packet type                  *)
  56.     srcAddr    * : Sana2Address;      (* source address               *)
  57.     dstAddr    * : Sana2Address;      (* dest address                 *)
  58.     dataLength * : LONGINT;           (* from header                  *)
  59.     data       * : e.APTR;            (* packet data                  *)
  60.     statData   * : StatDataPtr;       (* statics data pointer         *)
  61.     bufferMng  * : BufferMngDataPtr;  (* TagList / ProcTable          *)
  62.   END;
  63.  
  64. CONST
  65. (* defines for IOSana2Req.ioReq.flags *)
  66.  
  67.   raw   * = 7;         (* raw packet IO requested      *)
  68.   bcast * = 6;         (* broadcast packet (received)  *)
  69.   mcast * = 5;         (* multicast packet (received)  *)
  70.   quick * = e.quick;   (* quick IO requested (0)       *)
  71.  
  72. (* defines for OpenDevice() *)
  73.  
  74.   mine  * = 0;         (* exclusive access requested   *)
  75.   prom  * = 1;         (* promiscuous mode requested   *)
  76.  
  77. (* defines for OpenDevice() tags *)
  78.  
  79.   dummy        * = u.user + 0B0000H;
  80.   copyToBuff   * = dummy + 1;
  81.   copyFromBuff * = dummy + 2;
  82.  
  83. TYPE
  84.   StatData * = STRUCT END; (* dummy *)
  85.  
  86.   DeviceQuery * = STRUCT (dummy *: StatData)
  87.     (* standard information *)
  88.     sizeAvailable  * : LONGINT;    (* bytes available              *)
  89.     sizeSupplied   * : LONGINT;    (* bytes supplied               *)
  90.     devQueryFormat * : LONGINT;    (* this is type 0               *)
  91.     deviceLevel    * : LONGINT;    (* this document is level 0     *)
  92.     (* common information *)
  93.     addrFieldSize  * : INTEGER;    (* address size in bits         *)
  94.     mtu            * : LONGINT;    (* maximum packet data size     *)
  95.     bps            * : LONGINT;    (* line rate (bits/sec)         *)
  96.     hardwareType   * : LONGINT;    (* what the wire is             *)
  97.     (* format specific information *)
  98.   END;
  99.  
  100. CONST
  101. (*
  102. ** defined Hardware types
  103. **
  104. **  If your hardware type isn't listed below contact CATS to get a new
  105. **  type number added for your hardware.
  106. *)
  107.  
  108.   ethernet  * = 1;
  109.   ieee802   * = 6;
  110.   arcnet    * = 7;
  111.   localTalk * = 11;
  112.   dyLan     * = 12;
  113.   amokNet   * = 200;
  114.   PPP       * = 253;
  115.   SLIP      * = 254;
  116.   CSLIP     * = 255;
  117.  
  118. TYPE
  119.   PacketTypeStats * = STRUCT (dummy *: StatData)
  120.     packetsSent     * : LONGINT;  (* transmitted count            *)
  121.     packetsReceived * : LONGINT;  (* received count               *)
  122.     bytesSent       * : LONGINT;  (* bytes transmitted count      *)
  123.     bytesReceived   * : LONGINT;  (* bytes received count         *)
  124.     packetsDropped  * : LONGINT;  (* packets dropped count        *)
  125.   END;
  126.  
  127.   SpecialStatRecord * = STRUCT
  128.     type   * : LONGINT;           (* statistic identifier         *)
  129.     count  * : LONGINT;           (* the statistic                *)
  130.     string * : e.LSTRPTR;         (* statistic name               *)
  131.   END;
  132.  
  133.   SpecialStatHeader * = STRUCT (dummy *: StatData)
  134.     recordCountMax      * : LONGINT;  (* room available               *)
  135.     recordCountSupplied * : LONGINT;  (* number supplied              *)
  136.     (* struct Sana2SpecialStatRecord[RecordCountMax]; *)
  137.   END;
  138.  
  139.   DeviceStats * = STRUCT (dummy *: StatData)
  140.     packetsReceived      * : LONGINT;  (* received count               *)
  141.     packetsSent          * : LONGINT;  (* transmitted count            *)
  142.     badData              * : LONGINT;  (* bad packets received         *)
  143.     overruns             * : LONGINT;  (* hardware miss count          *)
  144.     unused               * : LONGINT;  (* 12-Nov-92 release bugfix     *)
  145.     unknownTypesReceived * : LONGINT;  (* orphan count                 *)
  146.     reconfigurations     * : LONGINT;  (* network reconfigurations     *)
  147.     lastStart            * : Timer.TimeVal;(* time of last online          *)
  148.   END;
  149.  
  150. CONST
  151. (* device commands *)
  152.   start              * = e.nonstd;
  153.  
  154.   deviceQuery         * = start + 0;
  155.   getStationAddress   * = start + 1;
  156.   configInterface     * = start + 2;
  157.   addMulticastAddress * = start + 5;
  158.   delMulticastAddress * = start + 6;
  159.   multicast           * = start + 7;
  160.   broadcast           * = start + 8;
  161.   trackType           * = start + 9;
  162.   untrackType         * = start + 10;
  163.   getTypeStats        * = start + 11;
  164.   getSpecialStats     * = start + 12;
  165.   getGlobalStats      * = start + 13;
  166.   onEvent             * = start + 14;
  167.   readOrphan          * = start + 15;
  168.   online              * = start + 16;
  169.   offline             * = start + 17;
  170.  
  171.   end                 * = start+18;
  172.  
  173. (* defined errors for IOSana2Req.ioReq.error (see also <exec/errors.h>) *)
  174.  
  175.   noError             * = 0;      (* peachy-keen                  *)
  176.   noResources         * = 1;      (* resource allocation failure  *)
  177.   badArgument         * = 3;      (* garbage somewhere            *)
  178.   badState            * = 4;      (* inappropriate state          *)
  179.   badAddress          * = 5;      (* who?                         *)
  180.   mtuExceeded         * = 6;      (* too much to chew             *)
  181.   notSupported        * = 8;      (* command not supported        *)
  182.   software            * = 9;      (* software error detected      *)
  183.   outOfService        * = 10;     (* driver is OFFLINE            *)
  184. (*
  185. ** From <exec/errors.h>
  186. **
  187. **  openFail    * = -1; (* device/unit failed to open *)
  188. **  aborted     * = -2; (* request terminated early [after AbortIO()] *)
  189. **  noCmd       * = -3; (* command not supported by device *)
  190. **  badLength   * = -4; (* not a valid length (usually IO_LENGTH) *)
  191. **  badAddress  * = -5; (* invalid address (misaligned or bad range) *)
  192. **  unitBusy    * = -6; (* device opens ok, but requested unit is busy *)
  193. **  selfTest    * = -7; (* hardware failed self-test *)
  194. **
  195. *)
  196.  
  197. (* defined errors for S2io_WireError *)
  198.  
  199.   genericError        * = 0;       (* no specific info available   *)
  200.   notConfigured       * = 1;       (* unit not configured          *)
  201.   unitOnline          * = 2;       (* unit is currently online     *)
  202.   unitOffline         * = 3;       (* unit is currently offline    *)
  203.   alreadyTracked      * = 4;       (* protocol already tracked     *)
  204.   notTracked          * = 5;       (* protocol not tracked         *)
  205.   buffError           * = 6;       (* buff mgt func returned error *)
  206.   srcAddress          * = 7;       (* source address problem       *)
  207.   dstAddress          * = 8;       (* destination address problem  *)
  208.   badBroadcast        * = 9;       (* broadcast address problem    *)
  209.   badMulticast        * = 10;      (* multicast address problem    *)
  210.   multicastFull       * = 11;      (* multicast address list full  *)
  211.   badEvent            * = 12;      (* unsupported event class      *)
  212.   badStatData         * = 13;      (* statdata failed sanity check *)
  213.   isConfigured        * = 15;      (* attempt to config twice      *)
  214.   nullPointer         * = 16;      (* null pointer detected        *)
  215.  
  216. (* defined events *)
  217.  
  218.   eventError          * = 0;       (* error catch all              *)
  219.   eventTx             * = 1;       (* transmitter error catch all  *)
  220.   eventRx             * = 2;       (* receiver error catch all     *)
  221.   eventOnline         * = 3;       (* unit is in service           *)
  222.   eventOffline        * = 4;       (* unit is not in service       *)
  223.   eventBuff           * = 5;       (* buff mgt function error      *)
  224.   eventHardware       * = 6;       (* hardware error catch all     *)
  225.   eventSoftware       * = 7;       (* software error catch all     *)
  226.  
  227. (*
  228. ** The SANA-II special statistic identifier is an unsigned 32 number.
  229. ** The upper 16 bits identify the type of network wire type to which
  230. ** the statistic applies and the lower 16 bits identify the particular
  231. ** statistic.
  232. **
  233. ** If you desire to add a new statistic identifier, contacts CATS.
  234. *)
  235.  
  236.   ethernetIDDummy * =  ASH(ethernet,16);
  237.  
  238. (*
  239. ** defined ethernet special statistics
  240. *)
  241.  
  242.   ethernetBadMulticast * =  ethernetIDDummy + 0;
  243. (*
  244. ** This count will record the number of times a received packet tripped
  245. ** the hardware's multicast filtering mechanism but was not actually in
  246. ** the current multicast table.
  247. *)
  248.  
  249.   ethernetRetries      * = ethernetIDDummy +1;
  250. (*
  251. ** This count records the total number of retries which have resulted
  252. ** from transmissions on this board.
  253. *)
  254.  
  255. END Sana2.
  256.  
  257.